import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
data=pd.read_excel('./学生课程成绩数据.xls')
plt.rcParams['font.sans-serif']=['SimHei']
data_cui=data[data['姓名']=='崔泽远']
# print(data_cui)
score=list(data_cui['分数'])
course=list(data_cui['课程名称'])
# print(score)
angle=np.linspace(0,2*np.pi,len(course),endpoint=False)
#闭合
score = np.concatenate((score, [score[0]]))
angle = np.concatenate((angle, [angle[0]]))
fig=plt.figure()
#设置画布颜色
fig.set_facecolor('k')
#设置子绘图区域的颜色
ax1=fig.add_axes([0.1,0.1,0.8,0.8])
ax1.set_facecolor('#222A35')
#叠加目标
ax=fig.add_axes([0.15,0.15,0.7,0.7],polar=True)
ax.plot(angle,score,'bo-',lw=2)
ax.set_thetagrids(angle * 180/np.pi, course, fontproperties="SimHei",color='#BB9C48')
ax.fill(angle,score,facecolor='g',alpha=0.2)
ax.set_title('崔泽远成绩',fontproperties='SimHei',fontsize=16)
plt.show()
